import { observable, action } from 'mobx';
 import API from '../../apis';
 import { message } from 'antd';

// export interface MapStoreProps {
//     update: Function;
//     getTitles: Function;
//     titles: string[];
//     params: any;
//     query: any;
// }

// export default class MapStore implements MapStoreProps {
export default class MapStore {
    @observable titles:any = [];
    @observable query = {};
    @observable params = {};
    // @observable baseParams = {};

    @action
    updateParams = (params: any) =>{
       this.query = {customid:params.customid,billids:params.billids};
    }

    @action
    update = (param) => {
        for (let key in param) {
            this[key] = param[key]
        }
    }
    @action
    getTitles = () => {
        //this.titles= ["上海泛微软件大厦"];
         API.getMapTitles({ ...this.query}).then(({ status, error, titles}) => {
             if (status == '1') {
                 this.titles = titles;
             } else {
                 message.error(error);
                 throw error;
             }
         })
    }
}